<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button onclick="openPage()">跳转下一个页面</button>
    <button onclick="forwardPage()">前进</button>

    <script>
        function openPage(){
            location.href = 'demo1.html';
        }
        function forwardPage(){
            history.forward();
            //history.go(0)  刷新页面
            //history.go(负数) 后退
            //history.go(正数) 前进
           
        }
        console.log(history.length);//历史记录条目
    </script>
</body>
</html>